package com.zjitc.control;

import com.zjitc.annotation.RequestMapping;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Create By IntelliJ IDEA
 *
 * @author: jsonor
 * @create-Time: 2017/10/30 15:45
 * @description: ${description}
 */
public class UserControl {

  @RequestMapping(url = "/add")
  public void add(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    System.out.println(request.getParameter("id"));
    response.getWriter().println("add method invoke");
  }

  @RequestMapping(url = "/delete")
  public void delete(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    response.getWriter().println("delete method invoke");
  }
  
  @RequestMapping(url = "/update")
  public void update(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    response.getWriter().println("update method invoke");
  }

  @RequestMapping(url = "/query")
  public void query(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    response.getWriter().println("query method invoke");
  }

  @RequestMapping(url = "/forward")
  public void forward(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    request.getRequestDispatcher("/user?method=add").forward(request, response);
  }
}
